#ifndef W_PRINTING
#define W_PRINTING
#include <iostream>

using namespace std;

void printp(const point& pt, bool f = 0);
void printw(wire* w, uint wsize, bool f = 0);

void printw(wire* w, uint wsize, bool f){
	if (!f)
		for (uint i = 0; i < wsize; i++){
		printf("this is wire nr: %u, it's point 1 is:\n", i+1);
		printp(*w[i].ps);
		printf("and other is:\n");
		printp(*w[i].pe);
	}
	else{
		FILE* out;
		for (uint i = 0; i < wsize; i++)
		{
			out = freopen("wire_pts_test.txt", "a", stdout);
			printf("this is wire nr: %u, it's point 1 is:\n", i+1);
			fclose (out);
			printp(*w[i].ps, 1);
			out = freopen("wire_pts_test.txt", "a", stdout);
			printf("and other is:\n");
			fclose (out);
			printp(*w[i].pe, 1);
		}
	}
}

void printp(const point& pt, bool f){
	if (!f){
		printf("pos: (%f, %f), ", pt.pos.x, pt.pos.y);
		printf("dpos: (%f, %f), ", pt.dpos.x, pt.dpos.y);
		printf("vel: (%f, %f), ", pt.vel.x, pt.vel.y);
		printf("F: (%f, %f), ", pt.fo.x, pt.fo.y);
		printf("mass: (%f)\n", pt.mass);
	}
	else{
		FILE* out = freopen("wire_pts_test.txt", "a", stdout);
		printf("pos: (%f, %f), ", pt.pos.x, pt.pos.y);
		printf("dpos: (%f, %f), ", pt.dpos.x, pt.dpos.y);
		printf("vel: (%f, %f), ", pt.vel.x, pt.vel.y);
		printf("F: (%f, %f), ", pt.fo.x, pt.fo.y);
		printf("mass: (%f)\n", pt.mass);
		fclose (out);
	}
}

#endif
